import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
import axios from 'axios'
//导入全局样式
import './assets/css/global.css'
//导入字体图标
import './assets/fonts/iconfont.css'

//把axios 挂载 Vue原型上
Vue.prototype.http = axios
//请求的根路径
axios.defaults.baseURL ='http://127.0.0.1:8888/api/private/v1/'
// 响应拦截器  简化返回值
axios.interceptors.response.use((ret)=>{
  return ret.data
},(err)=>{
  console.log( err );
})
// 头部加个 token 信息
axios.interceptors.request.use( config => {
  const tk = sessionStorage.getItem('token')
  config.headers.Authorization = tk
  return config
})

Vue.config.productionTip = false

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
